package com.hp.interview.concurrent.threads_run_in_order;

/**
 * @author libo
 * 通过主程序join使线程按顺序执行
 * 在父进程调用子进程的join()方法后，父进程需要等待子进程运行完再继续运行。
 */
public class ThreadMainJoinDemo {

    public static void main(String[] args) throws Exception {

        final Thread thread1 = new Thread(() -> System.out.println("产品经理正在规划新需求..."));
        final Thread thread2 = new Thread(() -> System.out.println("开发人员开发新需求功能"));
        final Thread thread3 = new Thread(() -> System.out.println("测试人员测试新功能"));

        thread1.start();
        thread1.join();
        thread2.start();
        thread2.join();
        thread3.start();
    }
}